<html>
  <head><title>SP Objects</title>
    <script src="codepress/codepress.js" type="text/javascript"></script> 
    <link rel="stylesheet" href="style.css" type="text/css" media="all" />
  </head>
  <body>

    <h1>Procedure Object: F_QT_ORIGINAL_IDOC.SQL</h1>
    <p><b>Author:</b> Will Chang</p>
    <p><b>Date:</b> July 20, 2007</p>
    <p><b>Abstract:</b></p>
    <p></b></p>
    <p><b>Sample Calls:</b></p>
    <p></b></p>
    <p></p>
    
    
    <h3>Tables:</h3>
    <ul>
      
        <li><b><a href="WEB_QUOTE_AUDIT_HISTORY.html">EBIZ1.WEB_QUOTE_AUDIT_HISTORY</a></b></li>
      
        <li><b><a href="WEB_QUOTE.html">EBIZ1.WEB_QUOTE</a></b></li>
      
    </ul>
    
    
    
    
    
    
    
    
    <h3>Source code:</h3>
    <div id="SQLsrc" >
<em>DROP</em>&nbsp;SPECIFIC&nbsp;<b>FUNCTION</b>&nbsp;EBIZ1.F_QT_ORIGINAL_IDOC<br />@<br /><em>CREATE</em>&nbsp;<b>FUNCTION</b>&nbsp;EBIZ1.F_QT_ORIGINAL_IDOC(<br />	piWebQuoteNum&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>CHARACTER</u>(10)<br />)<br /><b>RETURNS</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>VARCHAR</u>(50)<br />&nbsp;&nbsp;&nbsp;&nbsp;SPECIFIC&nbsp;EBIZ1.F_QT_ORIGINAL_IDOC<br />&nbsp;&nbsp;&nbsp;&nbsp;<b>LANGUAGE</b>&nbsp;<b>SQL</b><br />&nbsp;&nbsp;&nbsp;&nbsp;<b>NOT</b>&nbsp;DETERMINISTIC<br />&nbsp;&nbsp;&nbsp;&nbsp;READS&nbsp;<b>SQL</b>&nbsp;DATA<br />&nbsp;&nbsp;&nbsp;&nbsp;<b>CALLED</b>&nbsp;<b>ON</b>&nbsp;<b>NULL</b>&nbsp;<b>INPUT</b><br />&nbsp;&nbsp;&nbsp;&nbsp;<b>NO</b>&nbsp;EXTERNAL&nbsp;ACTION<br />&nbsp;<br /><i>-----------------------------------------------------------------------------------</i><br /><i>--</i><br /><i>--&nbsp;&nbsp;<b>Function</b>&nbsp;Name:&nbsp;EBIZ1.F_QT_ORIGINAL_IDOC</i><br /><i>--&nbsp;&nbsp;Specific&nbsp;Name:&nbsp;EBIZ1.F_QT_ORIGINAL_IDOC</i><br /><i>--&nbsp;&nbsp;File&nbsp;Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EBIZ1.F_QT_ORIGINAL_IDOC.<b>SQL</b></i><br /><i>--</i><br /><i>--&nbsp;&nbsp;Author:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Will&nbsp;Chang</i><br /><i>--&nbsp;&nbsp;<u>Date</u>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;July&nbsp;20,&nbsp;2007</i><br /><i>--</i><br /><i>--&nbsp;&nbsp;Abstract:&nbsp;Retrieves&nbsp;currncy&nbsp;code&nbsp;<b>for</b>&nbsp;a&nbsp;given&nbsp;3&nbsp;<u>char</u>&nbsp;country&nbsp;code.</i><br /><i>--</i><br /><i>--&nbsp;&nbsp;Sample&nbsp;Call:</i><br /><i>--</i><br /><i>--&nbsp;&nbsp;<b>values</b>(EBIZ1.F_QT_ORIGINAL_IDOC&nbsp;(<u>CHAR</u>(<s>'0000123591'</s>)));</i><br /><i>--&nbsp;&nbsp;<b>values</b>(EBIZ1.F_QT_ORIGINAL_IDOC&nbsp;(<u>CHAR</u>(<s>'0000123446'</s>)));</i><br /><i>--</i><br /><i>--&nbsp;&nbsp;MAINTENANCE&nbsp;LOG</i><br /><i>--</i><br /><i>--&nbsp;&nbsp;who&nbsp;&nbsp;<u>date</u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><em>comment</em></b></i><br /><i>--&nbsp;&nbsp;---&nbsp;&nbsp;----------&nbsp;&nbsp;---------------------------------------------------------------</i><br /><i>--&nbsp;&nbsp;Will&nbsp;07/20/07&nbsp;&nbsp;&nbsp;&nbsp;Initial&nbsp;version.</i><br /><i>--&nbsp;&nbsp;Will&nbsp;10/26/07&nbsp;&nbsp;&nbsp;&nbsp;<b>Only</b>&nbsp;<em>fetch</em>&nbsp;first&nbsp;<b>row</b>&nbsp;<b>only</b></i><br /><i>-----------------------------------------------------------------------------------</i><br /><em>BEGIN</em>&nbsp;ATOMIC<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;<em>DECLARE</em>&nbsp;vSapIntDocNum&nbsp;<u>VARCHAR</u>(50)&nbsp;<b>DEFAULT</b>&nbsp;<b>NULL</b>;&nbsp;<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>SET</em>&nbsp;vSapIntDocNum=&nbsp;(&nbsp;<em>select</em>&nbsp;OLD_VAL&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>from</b>&nbsp;EBIZ1.WEB_QUOTE_AUDIT_HISTORY&nbsp;<br />	&nbsp;&nbsp;<b>where</b>&nbsp;WEB_QUOTE_NUM&nbsp;=&nbsp;piWebQuoteNum<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>AND</b>&nbsp;USER_ACTION&nbsp;=<s>'SAVE_ORIGINAL_IDOC'</s><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>fetch</em>&nbsp;first&nbsp;<b>row</b>&nbsp;<b>only</b><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br />&nbsp;&nbsp;		<br />&nbsp;&nbsp;	<b>IF</b>&nbsp;COALESCE(vSapIntDocNum,&nbsp;<s>''</s>)&nbsp;=&nbsp;<s>''</s>&nbsp;<b>THEN</b><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>SET</em>&nbsp;vSapIntDocNum=<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<em>SELECT</em>&nbsp;SAP_INTRMDIAT_DOC_NUM&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>FROM</b>&nbsp;EBIZ1.WEB_QUOTE<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>where</b>&nbsp;WEB_QUOTE_NUM&nbsp;=&nbsp;piWebQuoteNum<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>fetch</em>&nbsp;first&nbsp;<b>row</b>&nbsp;<b>only</b>);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>END</em>&nbsp;<b>IF</b>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<b>RETURN</b>&nbsp;vSapIntDocNum;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><em>END</em><br />@<br />CALL&nbsp;DTOL.G_FN_EXEC_GRP(<s>'EBIZ1'</s>,&nbsp;<s>'F_QT_ORIGINAL_IDOC'</s>,&nbsp;<s>'public'</s>)<br />@
    </div> 
  </body>
</html>
